﻿using AbpApplication.InPut;
using CommunityToolkit.Mvvm.Input;
using NewWms.Apiservice;
using NPOI.HPSF;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;

namespace Reconstruct_Desktop.ViewModels.DialogsModel
{
    public partial class UpdateWarehouseLineDialogModel : BindableBase, IDialogAware
    {

        private readonly IBaseService _baseService;

        public UpdateWarehouseLineDialogModel()
        {
            _baseService = new BaseService();
            InPut_BaseService=new InPut_BaseService17();
        }

        [RelayCommand]
        private async void UpdateState(string obj)
        {
            InPut_BaseService.IsEnable = bool.Parse( obj);
            await _baseService.UpdateState_ByWarehouselineId(InPut_BaseService); 
            RequestClose?.Invoke(null);
        }






      public  string WarehouselineId { get; set; }

        private InPut_BaseService17 inPut_BaseService;

        public InPut_BaseService17 InPut_BaseService
        {
            get { return inPut_BaseService; }
            set { inPut_BaseService = value;RaisePropertyChanged(); }
        }







        //基础
        public string Title { get; set; } = "设置";

        public event Action<IDialogResult> RequestClose;

        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {
           
        }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            if (parameters.Count > 0)
            {
                string pars = parameters.GetValue<object>("1").ToString(); // 根据你的数据类型替换 'int'
                InPut_BaseService.Id_WarehouseLine = Guid.Parse( pars);
            }
        }
    }
}
